package com.storm.classes.color
{
	public class Color {
		public function Color(...params) {
			var count:int = params.length;
			if (count == 1) {
				this.color_rgb(params[0]);
			} else if (count == 3) {
				this.rgb_color(params[0], params[1], params[2]);
			}
		}
		
		private var _value:uint;
		public function get value():uint {
			return this._value;
		}
		
		private var _r:uint;
		public function get r():uint {
			return this._r;
		}
		
		private var _g:uint;
		public function get g():uint {
			return this._g;
		}
		
		private var _b:uint;
		public function get b():uint {
			return this._b;
		}
		
		private function color_rgb(value:uint):void {
			this._value = value;
			this._r = (value & 0xff0000) >> 16;
			this._g = (value & 0xff00) >> 8;
			this._b = (value & 0xff);
		}
		
		private function rgb_color(r:uint, g:uint, b:uint):void {
			this._r = r;
			this._g = g;
			this._b = b;
			this._value = (r << 16) | (g << 8) | b;
		}
	}
}